import { defineStore } from "pinia"

interface State {
  name: string
  age: number
}

export const useUserStore = defineStore("userInfo", {
  state: (): State => ({
    name: "Fe",
    age: 1,
  }),
  // 注意：persist定义要做判断，因为localStorage/sessionStorage是客户端参数，所以需要加process.client
  persist: process.client && {
    storage: sessionStorage,
  },
})
